import { loadCorpus } from './lib/corpus.js'
import { generate } from './lib/generator.js'
import { createRandomPicker } from './lib/random.js'
// fs.readFile('./corpus/data.json', {encoding: 'utf-8'},(err, data) => {//异步读取文件内容
//   if (err) {
//     console.error(err)
//     return
//   }
//   console.log(data.toString())
// })

const corpus=loadCorpus('./corpus/data.json')
const title=createRandomPicker(corpus.title)()
const article=generate(title,{corpus,min:2000,max:3000})
console.log(title);
console.log(article);

